{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "name": "Edge Detection.ipynb",
      "provenance": []
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    }
  },
  "cells": [
    {
      "cell_type": "code",
      "metadata": {
        "id": "YHDlTX5nCuJH"
      },
      "source": [
        "'''\r\n",
        "    For uploading the picture in colab follow the given steps\r\n",
        "    1. Click on the folder icon given in the left side of colab window\r\n",
        "    2. Click on the upload icon.\r\n",
        "    3. Select the image you want to upload.\r\n",
        "    4. Right click on the uploaded image, click on \"copy path\"\r\n",
        "    5. Paste it as a input when path will be asked \r\n",
        "'''\r\n",
        "#Importing openCV library\r\n",
        "import cv2 as cv\r\n",
        "#For printing the image in google colab\r\n",
        "from google.colab.patches import cv2_imshow\r\n",
        "\r\n",
        "path=input(\"Enter the path of uploaded image\")\r\n",
        "img=cv.imread(path)\r\n",
        "#Printing the original image\r\n",
        "cv2_imshow(img)\r\n",
        "#Reducing the noise from the image\r\n",
        "gray=cv.cvtColor(img,cv.COLOR_RGB2GRAY)\r\n",
        "\r\n",
        "#Using Canny algorithm to detect the edges of the image\r\n",
        "#You can vary the quality by changing 2nd and 3rd parameter in following function\r\n",
        "final=cv.Canny(gray,100,200)\r\n",
        "cv2_imshow(final)"
      ],
      "execution_count": null,
      "outputs": []
    }
  ]
}